package com.larry.design.creatation.factory;

import com.larry.design.creatation.factory.factorymethod.AbstractCarFactory;
import com.larry.design.creatation.factory.factorymethod.AudiCarFactory;
import com.larry.design.creatation.factory.simpleFactory.AbstractCar;
import com.larry.design.creatation.factory.simpleFactory.AudiCar;
import com.larry.design.creatation.factory.simpleFactory.BmwCar;
import com.larry.design.creatation.factory.simpleFactory.HuaSimpleFactory;
import org.junit.Test;

/**
 * @author larry
 * @Title: design-frame
 * @Package com.larry.design.creatation.factory
 * @Description: 测试类
 * @date 8/31/213:18 PM
 */
public class FactoryTest {

    @Test
    public void test1(){
        HuaSimpleFactory huaSimpleFactory = new HuaSimpleFactory();

        AbstractCar audi = huaSimpleFactory.newCar("audi");
        audi.run();
        AbstractCar bmw = huaSimpleFactory.newCar("bmw");
        bmw.run();
    }

    @Test
    public void test2(){
        AbstractCarFactory carFactory = new AudiCarFactory();
        com.larry.design.creatation.factory.factorymethod.AbstractCar abstractCar = carFactory.newCar();
        abstractCar.run();
    }

}
